<%-- 
    Document   : disable
    Created on : Apr 7, 2011, 9:43:36 AM
    Author     : Noi Nho
--%>

<%@page import="dto.User"%>
<%@page import="dao.UserDAO"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<c:if test="${param['username']=='' || param['username']==null}">
    <jsp:forward page="../../administrator.jsp?page=user" />
</c:if>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Set Role</title>
    </head>
    <body>
        <a href="administrator.jsp?page=user">User management</a>
        <form action="AdminAction?page=user&action=edit&username=${param['username']}" name="setRole" method="post">
            <%
                        UserDAO userDAO = new UserDAO();
                        User user = userDAO.getUserByUserName(request.getParameter("username").toString());
                        if (user != null) {
                            request.setAttribute("user", user);
            %>
            <select name="roleNo">
                <%
                                            if (user.getRoleNo() == 1) {
                %>
                <option value="1" selected ="true">Admin</option>
                <%                                            } else {
                %>
                <option value="2" selected ="true">User</option>
                <%                                                }

                %>

            </select>
            <br>
            Status:
            <br>
            <%
                                        if (user.isStatus()) {
            %>
            <input type="radio" name="status" value="true" checked="true"/> True<br />
            <input type="radio" name="status" value="false" /> False
            <%                            } else {

            %>
            <input type="radio" name="status" value="true" /> True<br />
            <input type="radio" name="status" value="false" checked="true"/> False
            <%                                        }
            %>
            <br>
            <input type="submit" name="submit" value="Ok">
            <input type="reset" name="reset" value="reset">
            <%
                        }
            %>

        </form>
    </body>
</html>
